#!/usr/bin/env python
# -*- coding:utf-8 -*-

from task.gsxt.search.cracker.gsxt_yunnan_worker import GsxtYunNanWorker


class GsxtDetailYunNanWorker(GsxtYunNanWorker):
    def __init__(self, **kwargs):
        GsxtYunNanWorker.__init__(self, **kwargs)

    def query_company(self, item):
        try:
            session = self.get_new_session(proxy_type=2)

            seed = item.get('_id', '')
            # 进一步获取详情
            result_length = self.get_detail_html_list(seed, session, item.get('search_list', None))
            if result_length > 0:
                return self.CRAWL_FINISH
        except Exception as e:
            self.log.exception(e)
        return self.CRAWL_UN_FINISH
